<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<base href="<%=basePath%>"/>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="shortcut icon" href="images/icon/${his.favicon}" />
		<title>${his.hospitalName}-健康提问</title>
		<link href="style/css.css" rel="stylesheet" type="text/css" />
		<SCRIPT src="js/jquery.js" type="text/javascript"></SCRIPT>
		 <SCRIPT LANGUAGE="JavaScript">
		//加载
            $(document).ready(function(){
            	$("#qage").bind("keypress",function(){
						if ((event.keyCode<48 || event.keyCode>57)) event.returnValue=false
					});
					$("#qage").bind("keyup",function(){
						if(isNaN(this.value)){
							this.value="";
						}
					});
					
            	$.getJSON("type.do?method=getKeshi",function(data){
                            if (data.length != 0) {
								//清空
                                $("#ks").html("<option value=''>请选择科室</option>");
                                for (i = 0; i < data.length; i++) {
									//追加option
									
                                    $("#ks").append("<option value=" + data[i].ks_id + ">" + data[i].ks_name + "</option>")
                                }
                            }
                        });
            
				//绑定对象
                $("#ks").bind("change", function(){
					//得到改变后的值
                    var getvalue = $("#ks option:selected").val(); 
                    if (getvalue != null) {
                        $.getJSON("type.do?method=getKebie", {ks_id: getvalue}, function(data){
                            if (data.length != 0) {
								//清空
                                $("#kb").html("<option value=''>请选择科别</option>");
                                for (i = 0; i < data.length; i++) {
									//追加option
                                    $("#kb").append("<option value=" + data[i].kb_name + ">" + data[i].kb_name + "</option>")
                                }
                            }
                        });
                    }
                });
            
                
            });
            
            function doCheck(){
                        var qtitle = document.AddForm.qtitle.value;   
                        var qemail = document.AddForm.qemail.value;   
                        var qinfo = document.AddForm.qinfo.value; 
                         var ks = document.AddForm.ks.value;
                         var qtype = document.AddForm.qtype.value;
                         var qage = document.AddForm.qage.value;
                        if(qtitle==""){
	                        alert("标题不能为空！");
	                        return false;
                        }
                        if(qage == ""){
                        	alert("年龄不能为空！");
                        	return false;
                        }
                         if(ks==""){
	                        alert("请选择科室");
	                        return false;
                        }
                         if(qtype==""){
	                        alert("请选择科别");
	                        return false;
                        }
                        
                       
                        
                         if(!verfifyEmail(qemail)){
							alert("请输入正确的e-mail地址!");
							 return false;
                        }
                        if(qinfo==""){
                       		alert("提问内容不能为空！");
	                        return false;
                        }
                        return true;
                      }
                         function verfifyEmail(strEmail){
							var CheckMail = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
							 if (!CheckMail.test(strEmail))
							 {
							  return false;
							 }else{
							 return true;
							 }
						}
        </SCRIPT>
	</head>

	<body>
		<style>
A.applink:hover {
	border: 2px dotted #DCE6F4;
	padding: 2px;
	background-color: #ffff00;
	color: green;
	text-decoration: none
}

A.applink {
	border: 2px dotted #DCE6F4;
	padding: 2px;
	color: #2F5BFF;
	background: transparent;
	text-decoration: none
}

A.info {
	color: #2F5BFF;
	background: transparent;
	text-decoration: none
}

A.info:hover {
	color: green;
	background: transparent;
	text-decoration: underline
}
</style>
		<jsp:include page="users/userTop.jsp"></jsp:include>
		<table width="779" border="0" align="center" cellpadding="0"
			cellspacing="0" style="margin-top: 7px">
			<tr>
				<td width="197" align="left" valign="top" bgcolor="#F6F9FB"
					class="bgxz_zhong_bk">
					<jsp:include page="users/userLeft.jsp"></jsp:include>
				</td>
				<td width="11" align="left" valign="top">
					&nbsp;
				</td>
				<td width="567" align="left" valign="top" class="bk">
					<table width="567" border="0" cellpadding="0" cellspacing="0"
						style="margin-bottom: 50px">

						<tr>
							<td height="28" align="right" valign="top" bgcolor="#FFFFFF"
								class="ind_zhong_bj">
								<table width="536" border="0" cellspacing="0" cellpadding="0"
									style="margin-top: 4px; margin-right: 10px">
									<tr>
										<td align="left" valign="middle">
											<strong><font color="#0B5596">我要提问</font> </strong>
										</td>
										<td align="right" valign="middle">
											<a  class="ztys_0B5596">首页</a><span
												class="ztys_0B5596">－</span><a
												 class="ztys_0B5596">健康顾问</a>
										</td>
									</tr>
								</table>
							</td>
						</tr>
						<tr>
							<td align="left" valign="top" bgcolor="#FFFFFF">
						<form name="AddForm" action="question.do?method=question"
							method="post"
							enctype="multipart/form-data">
							<input type="hidden" name="token" value="<%= Math.random() %>"/>
								<table width="535" border="0" cellspacing="0" cellpadding="0"
									style="margin-top: 20px; margin-left: 16px">
									<tr>
										<td>
											<table width="535" border="0" cellpadding="0" cellspacing="1"
												bgcolor="#9BC8EB">

												<tr>
													<td width="106" height="27" align="center" valign="middle"
														bgcolor="#FFFFFF">
														标题
														<font color="#FF0000">*</font>
													</td>
													<td height="27" align="left" valign="middle"
														bgcolor="#FFFFFF" class="jj_l_5">
														<input name="qtitle" type="text" size="20" />
													</td>
												</tr>
												<tr>
													<td width="106" height="27" align="center" valign="middle"
														bgcolor="#FFFFFF">
														个人信息
														<font color="#FF0000">*</font>
													</td>
													<td height="27" align="left" valign="middle"
														bgcolor="#FFFFFF" class="jj_l_5">
														性别：
														<input type="radio" name="qsex" value="男" checked />
														男 &nbsp;
														<input type="radio" name="qsex" value="女" />
														女 &nbsp;&nbsp;年龄：
														<input name="qage" type="text" size="8" maxlength="2" id="qage"/>
													</td>
												</tr>
												<tr>
													<td width="106" height="27" align="center" valign="middle"
														bgcolor="#FFFFFF">
														问题分类
														<font color="#FF0000">*</font>
													</td>
													<td height="27" align="left" valign="middle"
														bgcolor="#FFFFFF" class="jj_l_5">
												
														<!--科室 -->
            <span class="keshi">
                <SELECT id="ks" name="ks">                
                    <option value="">请选择科室</option>
                </SELECT>
            </span>
				<!--科别 -->
            <span class="kebie" id="kbs">
                <SELECT id="kb" name = "qtype">
                    <option value="">请选择科别</option>
                </SELECT>
            </span>
			 
													</td>
												</tr>
												<tr>
													<td width="106" height="82" align="center" valign="middle"
														bgcolor="#F5F5F5">
														邮件地址
													</td>
													<td height="27" align="left" valign="middle"
														bgcolor="#FFFFFF">
														&nbsp;<input name="qemail" type="text" size="20" />
														<br />
														&nbsp;填写邮箱地址，有新的回答就会发送邮件到您的邮箱，让您可以及时收到
													</td>
												</tr>
												<tr>
													<td width="106" height="117" align="center" valign="middle"
														bgcolor="#F5F5F5">
														详细描述问题
														<font color="#FF0000">*</font>
													</td>
													<td height="171" align="left" valign="middle"
														bgcolor="#FFFFFF">
														<table width="394" height="166" border="0" cellpadding="0"
															cellspacing="0">

															<tr>
																<td align="center" valign="top">
																	<table width="394" height="130" border="0"
																		cellpadding="0" cellspacing="0" class="zjzx_tj_bjbk"
																		style="margin-left: 3px">
																		<tr>
																			<td align="left" valign="top">
																				<textarea name="qinfo" cols="50" rows="9"></textarea>
																				<br />
																				请详细描述您的病情，必要时请添加病历等辅助材料，您的问题说明越详细，得到的回答将会越准确
																			</td>
																		</tr>
																	</table>
																</td>
															</tr>
														</table>
													</td>
												</tr>
											</table>
										</td>
									</tr>
									<tr>
										<td height="44" align="left" valign="middle">
											<table border="0" cellspacing="0" cellpadding="0"
												style="margin-left: 234px">
												<tr>
													<td width="72" align="left" valign="top">
													<input type="hidden" name="uid" value="${userinfo.uid}"/>
														<input type="image" src="images/zjzxtj_102.gif"
															width="44" height="18" border="0" onclick="return doCheck()" />
													</td>
													<td align="left" valign="top">
														<a href="javascript:res()"><img
																src="images/zjzxtj_104.gif" width="44" height="18"
																border="0" /> </a>
													</td>
												</tr>
											</table>
										</td>
									</tr>
								</table>
						</form>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
											

		<table width="779" height="114" border="0" align="center"
			cellpadding="0" cellspacing="0" style="margin-top: 13px">
			<tr>
				<td height="85" align="center" valign="top">
					<table border="0" cellpadding="0" cellspacing="0"
						style="margin-top: 5px">
						<tr>
							<td align="center" valign="middle">
								<jsp:include page="users/yejiao.jsp"></jsp:include>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>

	</body>
</html>

